/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.elucid.chess.model;


/**
 *
 * @author George
 */
public class Move {
    private final Square fromSquare;
    private final Square toSquare;


	private boolean potentialCapture = false;
	private Piece srcPiece;
	private Piece dstPiece;
    
    public Move(Square fromSquare, Square toSquare)
    {
        this.fromSquare = fromSquare;
        this.toSquare = toSquare;
        
    }

    public Move(Square fromSquare, Square toSquare, boolean capture) {
        this(fromSquare, toSquare);
        this.setPotentialCapture(capture);
    }

    @Override
    public boolean equals(Object obj) {
        
        Move move = (Move) obj;
        return ( move.fromSquare == null || move.fromSquare.equals(this.fromSquare)) &&
                ( move.toSquare == null || move.toSquare.equals(this.toSquare));
    }
    
    @Override
    public String toString() {
    	return String.format("%s->%s", fromSquare, toSquare);
    }
    
    public Square getFromSquare() {
        return fromSquare;
    }

    public Square getToSquare() {
        return toSquare;
    }

	public boolean isPotentialCapture() {
		return potentialCapture;
	}

	public void setPotentialCapture(boolean capture) {
		this.potentialCapture = capture;
	}

	public void setSrcPiece(Piece srcPiece) {
		this.srcPiece = srcPiece;
	}

	public void setDstPiece(Piece dstPiece) {
		this.dstPiece = dstPiece;
	}

    public Piece getSrcPiece() {
		return srcPiece;
	}

	public Piece getDstPiece() {
		return dstPiece;
	}            
}
